package model

import (
	"fmt"
	"github.com/wejectchen/ginblog/utils/errmsg"
	"gorm.io/gorm"
)

type Hello struct {
	gorm.Model
	Username string `gorm:"type:varchar(20);not null " json:"username" validate:"required,min=2,max=12" label:"用户名"`
	Password string `gorm:"type:varchar(500);not null" json:"password" validate:"required,min=6,max=120" label:"密码"`
	Role     int    `gorm:"type:int;DEFAULT:2" json:"role" validate:"required,gte=2" label:"角色码"`
}

func GetHelloList() (Hello, int) {
	var hello Hello
	err := db.Where("ID !=", 0).Find(&hello).Error
	if err != nil {
		fmt.Println("获取db错误hello", err)
	}
	return hello, errmsg.SUCCESS
}
